<template>
	<view class="view-top">
		<index-tabbar :tabBars="tabBars" @TarTap="TarData" :tabIndex="tabIndex"></index-tabbar>
		<component v-bind:is="currentTabComponent"></component>
		<image src="../../static/img/bell.png" class="bell" @click="clickbell"></image>
	</view>
</template>

<script>
	import indexTabbar from './topBar.vue';
	import supplyHall from './Supply-hall/Supply-hall.vue';
	import regularRoute from './Regular-route/Regular-route.vue';
	export default {
		components: {
			indexTabbar,
			supplyHall,
			regularRoute
		},
		data() {
			return {
				tabIndex: "supplyHall",
				tabBars: [{
						name: "货源大厅",
						id: "supplyHall"
					},
					{
						name: "常跑线路",
						id: "regularRoute"
					}
				],
				currentTabComponent: "supplyHall"
			}
		},
		onLoad() {

		},
		methods: {
			TarData(item) {
				this.tabIndex = item.id;
				this.currentTabComponent = item.id
			},
			clickbell(){
				uni.navigateTo({
					url: "/pages/found-goods/Message-center/Message-center"
				})
			}
		}
	}
</script>

<style>
	.view-top{
		margin: 0 auto;
	}
	.bell {
		width: 30px;
		height: 30px;
		position: absolute;
		top: 35rpx;
		right: 30rpx;
	}
</style>
